package org.yi.demo.annodemo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.yi.demo.annodemo.entity.UsersEntity;

public interface UserMapper {

	@Insert("insert into users (name, age, sex) values (#{name}, #{age}, #{sex})")
	public int addUser(UsersEntity user);
	
	@Delete("delete from users where id = #{id}")
	public int delete(int id);
	
	@Update("update users set name = #{name}, age = #{age}, sex = #{sex} where id = #{id}")
	public int update(UsersEntity user);
	
	@Select("select * from users where id = #{id}")
	public UsersEntity getUser(int id);
	
	@Select("select * from users")
	public List<UsersEntity> getALl();
	
}
